<template>
  <div class="friends-page">
    <div class="pc">
      <div class="f-p-swiper">
        <div class="arrow-left">
          <img @click="prevClick" :src="images.arrow_left" />
        </div>

        <div class="swiper-box">
          <swiper class="swiper" ref="mySwiper" :options="swiperOptions">
            <swiper-slide v-for="(item, index) in friends_images" :key="index">
              <img class="swiper_img" :src="item.image" />
            </swiper-slide>
          </swiper>
        </div>

        <div class="arrow-right">
          <img @click="nextClick" :src="images.arrow_right" />
        </div>
      </div>
    </div>

    <div class="mobile">
      <ul>
        <li v-for="(item, index) in friends_images" :key="index">
          <img :src="item.image" />
        </li>
      </ul>
    </div>
  </div>
</template>

<script>
import { swiper, swiperSlide } from "vue-awesome-swiper";
import "swiper/swiper-bundle.css";

export default {
  name: "FriendsPage",
  components: {
    swiper,
    swiperSlide,
  },
  data() {
    return {
      // static
      images: {
        arrow_left: require("@/assets/images/friends/friends_arrow_left.png"),
        arrow_right: require("@/assets/images/friends/friends_arrow_right.png"),
      },
      friends_images: [
        // {
        //   id: 1,
        //   image: require("@/assets/images/friends/friends_HuaXin.png"),
        // },
        // {
        //   id: 2,
        //   image: require("@/assets/images/friends/friends_MoJing.png"),
        // },
        // {
        //   id: 3,
        //   image: require("@/assets/images/friends/friends_MingChuang.png"),
        // },
        // {
        //   id: 4,
        //   image: require("@/assets/images/friends/friends_FeiKe.png"),
        // },
        // {
        //   id: 5,
        //   image: require("@/assets/images/friends/friends_WenXi.png"),
        // },
        {
          id: 6,
          image: require("@/assets/images/friends/friends_NFTGO.jpg"),
        },
        {
          id: 7,
          image: require("@/assets/images/friends/friends_NFTNerds.jpg"),
        },
        {
          id: 8,
          image: require("@/assets/images/friends/firends_Opensea.jpg"),
        },
        {
          id: 9,
          image: require("@/assets/images/friends/friends_LooksRare.jpg"),
        },
      ],
      // swiper
      swiperOptions: {
        slidesPerView: 4,
        slidesPerGroup: 1,
        observer: true,
        observeParents: true,
        spaceBetween: 28,
        loop: true,
        autoplay: false,
        // simulateTouch: false,
        navigation: {
          nextEl: ".swiper-button-next",
          prevEl: ".swiper-button-prev",
        },
      },
    };
  },
  methods: {
    // btn prev1
    prevClick() {
      this.$refs.mySwiper.swiper.slidePrev();
    },
    // btn next
    nextClick() {
      this.$refs.mySwiper.swiper.slideNext();
    },
  },
};
</script>

<style lang="less" scoped>
.friends-page {
  width: 100%;
  height: 269px;
  background: #0f1626;
  margin-top: -21px;
  overflow: hidden;
  z-index: 3;

  .mobile {
    display: none;
  }

  .pc {
    .f-p-swiper {
      position: relative;
      box-sizing: border-box;
      width: 1200px;
      height: 125px;
      margin: 0 auto;
      margin-top: 81px;

      .arrow-left,
      .arrow-right {
        position: absolute;
        top: 50%;
        margin: 0;
        padding: 0;
        z-index: 2;

        img {
          width: 60px;
          cursor: pointer;
        }
      }
      .arrow-left {
        left: 0;
        transform: translateY(-50%) translateX(-50%);
      }
      .arrow-right {
        right: 0;
        transform: translateY(-50%) translateX(50%);
      }

      .swiper-box {
        width: 1200px;
        height: 100%;

        .swiper_img {
          width: 276px;
          height: 120px;
          background-color: white;
          cursor: pointer;
        }
      }
    }
  }
}

@media screen and (max-width: 768px) {
  .friends-page {
    width: 100%;
    min-height: 52.2667vw;
    height: auto;
    overflow: hidden;
    margin-top: 0;

    .pc {
      display: none;
    }

    .mobile {
      display: block;
      width: 100%;
      height: 100%;
      overflow: hidden;

      ul,
      li {
        list-style: none;
        margin: 0;
        padding: 0;
      }
      ul {
        display: flex;
        flex-wrap: wrap;
        justify-content: space-between;
        align-content: flex-start;
        height: 100%;
        margin: 5.3333vw 5.0667vw 0 5.0667vw;
        overflow: hidden;

        li {
          width: 42.4vw;
          height: 18.4vw;
          background: #ffffff;
          font-size: 0;
          margin-bottom: 4.8vw;

          img {
            display: block;
            width: 100%;
            height: 100%;
          }
        }
      }
    }
  }
}
</style>
